// webpack 是 node 写出来的, node的写法
let path = require('path')
let HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
    devServer: {
        // 开发服务器的配置
        port: 5000,
        progress: true,
        contentBase: './build',
        compress: true,
        open: true
    },
    // mode: 'development', // 默认两种 production development
    mode: 'development',
    entry: {
        home: './src/index.js',
        other: './src/other.js',
    }, //  入口
    output: {
        filename: '[name].js', // 打包后的文件名
        path: path.resolve(__dirname, 'dist'), // 路径必须是一个绝对路径 
        // publicPath: 'http://www.zhufengpeixun.cn',
    },
    plugins: [
        new HtmlWebpackPlugin({
            filename: 'home.html',
            template: './src/index.html',
            chunks: ['home']
        }),
        new HtmlWebpackPlugin({
            filename: 'other.html',
            template: './src/index.html',
            chunks: ['other', 'home']
        }),
    ],
    externals: {
    },
    module: { // 模块
        rules: [ // loader 默认是 从右到左 从下到上执行
            
        ]
    }
}